UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NcUuEsf8kSL//fXykMOWnWBiyhNO6uDdb7w9Gr8GP5U=' 
WHERE 
  key_id = 'fd31a0ade212bb757258a3122241384111e5337849975a70b0d211542dc4178c' 
  AND (
    token = 'NcUuEsf8kSL//fXykMOWnWBiyhNO6uDdb7w9Gr8GP5U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016