UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QQivthp1EEVK+1Cwx1qSxsuW9RCXniO0gBCR3xe+wcE=' 
WHERE 
  key_id = 'a5f4201a93aa7a175cb37b2e28f127202b7d712c0a311b59dbb502a525d5fcd6' 
  AND (
    token = 'QQivthp1EEVK+1Cwx1qSxsuW9RCXniO0gBCR3xe+wcE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031