UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1Ehe4dMRz6w/EfnB8wH4vhQFPgmkhYF9KIutgWH00AM=' 
WHERE 
  key_id = 'f7341d473bba992968bcbebe2c79deac328d01e736e29e158c3374521f66413a' 
  AND (
    token = '1Ehe4dMRz6w/EfnB8wH4vhQFPgmkhYF9KIutgWH00AM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024