UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZnuULSlvANckCvaXDYYfwA7+yxGS0+dMw7n5kNaWdsY=' 
WHERE 
  key_id = '8fad3b929570fa8c8780e160bbc9540a08095424327190af136250df29c08ad3' 
  AND (
    token = 'ZnuULSlvANckCvaXDYYfwA7+yxGS0+dMw7n5kNaWdsY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039