UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HbUdgt4/iFd+7yXDN2MKVOD8xXF5v/e2KBrz0qBB0jM=' 
WHERE 
  key_id = 'a860408859aad9e36eb302abc92a37983d31ba63e904f4591123d3ff1aed0902' 
  AND (
    token = 'HbUdgt4/iFd+7yXDN2MKVOD8xXF5v/e2KBrz0qBB0jM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015