UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LW/2hVnce9d4kgzKC15J+Thb1fo+iLMebNKsdYeJ5Ig=' 
WHERE 
  key_id = 'aee3949c3a6967fc545ac14123b15b700592de9dc92974702c241900283bd0d4' 
  AND (
    token = 'LW/2hVnce9d4kgzKC15J+Thb1fo+iLMebNKsdYeJ5Ig=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032