UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iqbxuKt/82Bmv7LvlMbd12Wdkt5QcUdehMpYmO8NE2I=' 
WHERE 
  key_id = '5a74a4e73f63e099ce21fd0297c1553a2029a5f36e4adcd66ff8d433a38729ab' 
  AND (
    token = 'iqbxuKt/82Bmv7LvlMbd12Wdkt5QcUdehMpYmO8NE2I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030