UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ocALpPk+i5yWQ6UIVqphC1yUbmdD9gkuoajr+7vE4kY=' 
WHERE 
  key_id = '654a149cf2b6cb0b1d65b0241bfa2871ff3ab9b3c58ceb925b68bd6513295e1a' 
  AND (
    token = 'ocALpPk+i5yWQ6UIVqphC1yUbmdD9gkuoajr+7vE4kY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020