UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'E9YB3KTIJ+jmTORNN8bYz3jP6fj/EM+6eyaAW8KSH6Q=' 
WHERE 
  key_id = '6bb9d45539554f0416b045d383d3fad7b798180acc9e83cb81a4e4ae89e8ab33' 
  AND (
    token = 'E9YB3KTIJ+jmTORNN8bYz3jP6fj/EM+6eyaAW8KSH6Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027