UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JrGGVkTgI0jd8D1R0CQgEuBWep07EfONnxpEEj/ZbJ8=' 
WHERE 
  key_id = 'b3163a49371afe64db03cce74dda4b2032f3902b2490a6cd736e814ee4e31f15' 
  AND (
    token = 'JrGGVkTgI0jd8D1R0CQgEuBWep07EfONnxpEEj/ZbJ8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032