UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1GeEP7gBGnjDxmGJgeXTJ5cJGoiPqlLu+q59dJWzxEc=' 
WHERE 
  key_id = 'b038518250f96103b520afb00cd3514be3b4b0b4ebba97926bec6c4022ab677c' 
  AND (
    token = '1GeEP7gBGnjDxmGJgeXTJ5cJGoiPqlLu+q59dJWzxEc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036