UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cIWuU4T1dQCMBHQSzUcmuNkehKh3FxFCc4SqCOQB9nM=' 
WHERE 
  key_id = '3e1b00bf4369867927c937f45467190fdcaddc05c4e288bd90dbb19d307d9e52' 
  AND (
    token = 'cIWuU4T1dQCMBHQSzUcmuNkehKh3FxFCc4SqCOQB9nM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031