UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+YQ0xNTfQwLDyPSiVQBNJcZa+WGMdAODku+c98GRP7I=' 
WHERE 
  key_id = '6caad92e401da4bad1c928f44c8b9403886a7085dea7c6efb73e4e496675fa88' 
  AND (
    token = '+YQ0xNTfQwLDyPSiVQBNJcZa+WGMdAODku+c98GRP7I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032