UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8FL5Jx5GcrZgjsbMea1GugCn1KwV9umU39lQsZnhce4=' 
WHERE 
  key_id = '966243e41d4178d0c96504dbf625c2a04806569422b21affca364ea14293ef90' 
  AND (
    token = '8FL5Jx5GcrZgjsbMea1GugCn1KwV9umU39lQsZnhce4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034