UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ALMG816Dr9fk/FwOnNS758rG0t+ytDUO3FACfKYiJZo=' 
WHERE 
  key_id = '0d2a0855d37f66741b24e56477628430fad45835f9db4672de0c6b71adbe8821' 
  AND (
    token = 'ALMG816Dr9fk/FwOnNS758rG0t+ytDUO3FACfKYiJZo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045