UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'u7Ey2a4M7p+3Pj1rg4cBtwZqQWeTsXG9VduV4woFVnw=' 
WHERE 
  key_id = '48252656ffc3234c97d87f085089e36c58cd0c11a18d02bd93bf385673b16645' 
  AND (
    token = 'u7Ey2a4M7p+3Pj1rg4cBtwZqQWeTsXG9VduV4woFVnw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032