UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9eXIO5GuNa2/FhvvNiWi2ih67jAxKQIbXzN+3IMmKqQ=' 
WHERE 
  key_id = 'b2794f75f0e1180f694cbf1f5f50a5f9b994c60ec0dee529279a1efba4829271' 
  AND (
    token = '9eXIO5GuNa2/FhvvNiWi2ih67jAxKQIbXzN+3IMmKqQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034