UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uvU5HD6AMb4UqGLk8F5/avqwsIWpNhu4ow8JgOBLg9Q=' 
WHERE 
  key_id = '5828e7d99914816f34b799fd179cd87eb249142c1b975bd85bd063047dad905d' 
  AND (
    token = 'uvU5HD6AMb4UqGLk8F5/avqwsIWpNhu4ow8JgOBLg9Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027