UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CcUqBqdNbwwjQHmjGT3mRAl2kP1Avli/yYzVJBSg3iM=' 
WHERE 
  key_id = '783c5d109a0b361e4a8df7dc3665e895503497276ddcfc786dc866c778206b05' 
  AND (
    token = 'CcUqBqdNbwwjQHmjGT3mRAl2kP1Avli/yYzVJBSg3iM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046