UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dXWx9xG1+pWDrWN0DaB3VFUZ6DlYkQIwOfCqEL+FJy0=' 
WHERE 
  key_id = 'b93fd62a0e408b11ddc76ad2ff78b97eaa2ba9cae1b166fe1d66233c81072dfc' 
  AND (
    token = 'dXWx9xG1+pWDrWN0DaB3VFUZ6DlYkQIwOfCqEL+FJy0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028