UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5ABW7y6Q04PgvkZd93lD9ciBUSZHYjM9xuug497LD+s=' 
WHERE 
  key_id = '3b815b223fefcca7be87f6f69db4049a3b2f88f93d57f65c82dba276c230fb99' 
  AND (
    token = '5ABW7y6Q04PgvkZd93lD9ciBUSZHYjM9xuug497LD+s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040