UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x6NVZAunl2pPEs11Z4/iTu/5APYb4dfdwohsarXOfQE=' 
WHERE 
  key_id = '5617bcc65da2922ab5568c44ffd630a92397faa131cc1c45ba6e314cbe7893e2' 
  AND (
    token = 'x6NVZAunl2pPEs11Z4/iTu/5APYb4dfdwohsarXOfQE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036