UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GqOQ1Wk8HD7P6aJc93WB6t++XBA675qeRdAHPAkOMCA=' 
WHERE 
  key_id = '442abea8771ae3332d1196daf4bfc1d5b15855725aeaf40672308989347a0fce' 
  AND (
    token = 'GqOQ1Wk8HD7P6aJc93WB6t++XBA675qeRdAHPAkOMCA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038