UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'veXMUGopSNtgBacXIEKB7I/mSnvOX53ChTp3KjbmLUw=' 
WHERE 
  key_id = '31ee38ac256d193a4672ad59735e6990e30600a2d79a53d0768c5a83261f11b8' 
  AND (
    token = 'veXMUGopSNtgBacXIEKB7I/mSnvOX53ChTp3KjbmLUw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053