UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w1Ux6dCAGcIrFZ3WVLerS3O0vbMFGB7pwaWyRXCpOYo=' 
WHERE 
  key_id = '5d49bbc3c1b042727b63c7448261f5762bde25237e67cbf35a78cdd4630555f6' 
  AND (
    token = 'w1Ux6dCAGcIrFZ3WVLerS3O0vbMFGB7pwaWyRXCpOYo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043