UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O8yY6MpfxZvaC6vLzZof1qlhg04rNflBgHO+p4H89Yk=' 
WHERE 
  key_id = '046318d383fedb07689bc59f0003afc879f3486ed6bcfd77f4d615f98f5eb72f' 
  AND (
    token = 'O8yY6MpfxZvaC6vLzZof1qlhg04rNflBgHO+p4H89Yk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038