UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wtAkukrYKxjygToo0G81GHcMvpAVGhMlIVLR7FdIl40=' 
WHERE 
  key_id = '36a5fa7b9af904ccefaf553f1b1e4e52ca93ceb8d2ca7f88feea90423652ed1f' 
  AND (
    token = 'wtAkukrYKxjygToo0G81GHcMvpAVGhMlIVLR7FdIl40=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036