UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ay0aYQqLoKQoL+ZI2E/cpR1C9LPbGeIQiHEa8/M48dE=' 
WHERE 
  key_id = '06bd8c91485de1d8601a3778985af77469e73e5ae3826382a3b406aa11dd5824' 
  AND (
    token = 'ay0aYQqLoKQoL+ZI2E/cpR1C9LPbGeIQiHEa8/M48dE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040