UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8neQz+S+oYy28kEwNXX6B8G69TT9EjyNmKGwIqxvEwY=' 
WHERE 
  key_id = 'b6c9aa37ed70157bbe529f73a062052090e65343e0f257d5b753bdb642484d2f' 
  AND (
    token = '8neQz+S+oYy28kEwNXX6B8G69TT9EjyNmKGwIqxvEwY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041