UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qRHPBadT1hQv/MJb9v9LlftLT5ON3CiUKx0X5Oi+/mc=' 
WHERE 
  key_id = '213ffdaca0091ba548e3aa669513adb226f3678d903203229165fcb37f0a8650' 
  AND (
    token = 'qRHPBadT1hQv/MJb9v9LlftLT5ON3CiUKx0X5Oi+/mc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036