UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jjiCnnTe1g1D9JLbPATqZvH4+e/v8t6cANZio0zh3rc=' 
WHERE 
  key_id = 'a5742d21c6bcdd6b1cd38f435cc69d4b914dfb17cab9fb6849baa2e89bfd92c5' 
  AND (
    token = 'jjiCnnTe1g1D9JLbPATqZvH4+e/v8t6cANZio0zh3rc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021