UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oqFSEEuD0QWjw4WQfdYKuSjXiNnfZ/zOix9zBjCHxZw=' 
WHERE 
  key_id = '56b2b023e51eec3f9302e226ef69cb9b542427da15e3c04485de62315a991a2a' 
  AND (
    token = 'oqFSEEuD0QWjw4WQfdYKuSjXiNnfZ/zOix9zBjCHxZw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028