UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DFvKwTae1Oj3UWLRDMRYAga419D2krd3ngGg1xIENS4=' 
WHERE 
  key_id = 'd2b2be16ef6096f2e438effc467bce007629d22e02d1e154785294f62bd9eb82' 
  AND (
    token = 'DFvKwTae1Oj3UWLRDMRYAga419D2krd3ngGg1xIENS4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020