UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'u/WSlvOGdS5+y1BlmxP4U8en9EcNz4pnqIsSV6ZgUNk=' 
WHERE 
  key_id = 'a032ec7743bdab82eddb83ba9a54e587b3b142c3c447b1c221266c8d6ee6b565' 
  AND (
    token = 'u/WSlvOGdS5+y1BlmxP4U8en9EcNz4pnqIsSV6ZgUNk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058