UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KQsxZZQEAXjuFhrmvX1PNaymYmjK0djJ4B2Tm0CL0GY=' 
WHERE 
  key_id = 'ca1852cbfd8c5d3d2b23a38f898f9eeb5f626caf8d56de20ab4493ff8496a325' 
  AND (
    token = 'KQsxZZQEAXjuFhrmvX1PNaymYmjK0djJ4B2Tm0CL0GY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023