UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pTuHpodUT8dOuaTFYiXNqaQc/o6R0EmZIfax8hXQYtQ=' 
WHERE 
  key_id = '7023c458b8bd00ac221aed8c200ff484ed34ab612effbb6874ed936193bba9a8' 
  AND (
    token = 'pTuHpodUT8dOuaTFYiXNqaQc/o6R0EmZIfax8hXQYtQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035