UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZQikCpkewjHb0sTAL0IjsQj1oYMumHy9whPlE224MEk=' 
WHERE 
  key_id = '31dc5dc5bab7e12450d182728238fea9ae99cee0fb6468738bf6b308cb43573a' 
  AND (
    token = 'ZQikCpkewjHb0sTAL0IjsQj1oYMumHy9whPlE224MEk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050