UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jWqFGGDTDjZZ0TrCeh5bUO2Jt/Xw7PNNRIQMYE01vR8=' 
WHERE 
  key_id = 'bcddf9b86c425c31d5bf51b1f25bcb47178102614fc621d821769f07b7109fc4' 
  AND (
    token = 'jWqFGGDTDjZZ0TrCeh5bUO2Jt/Xw7PNNRIQMYE01vR8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032