UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0pP5tT5Ll8FOPJZJP65wP+PxL/furdHMRy3SSyzr66U=' 
WHERE 
  key_id = '32387479b9fb69c68d8f93870dc4b14a68715ce9efe0992ee9b60ad27c3321dc' 
  AND (
    token = '0pP5tT5Ll8FOPJZJP65wP+PxL/furdHMRy3SSyzr66U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028