UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Zzh4E+vnhyWiskfRxuvSVdwb3qi93gonK+u2+c+LbAI=' 
WHERE 
  key_id = '5f1ddf32e1923469fdc0350fb6475b7880c1ba06dac1298e0200500a0b28a480' 
  AND (
    token = 'Zzh4E+vnhyWiskfRxuvSVdwb3qi93gonK+u2+c+LbAI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026