UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'S/zY9SNWwkwFQgX+m2B6f6XQsXoP3UnRXGaByOAeT7c=' 
WHERE 
  key_id = 'e1712e0f073f06b1563e8190d8181b35f85a83ef80fde689cbc0cf587b9045ad' 
  AND (
    token = 'S/zY9SNWwkwFQgX+m2B6f6XQsXoP3UnRXGaByOAeT7c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038