UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ja+5dq07a4B6MkqzZgHxsoHerRD2V3tL6arFCqzx7B4=' 
WHERE 
  key_id = '54f79d15b833f3f9b2c0926d9edc0549f883dcd3e2c61ada0cd106dc747c759d' 
  AND (
    token = 'Ja+5dq07a4B6MkqzZgHxsoHerRD2V3tL6arFCqzx7B4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032