UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vfp9LT5Y9pNJdM7ny9x41day33bqPuOhh/kYTGTL8IA=' 
WHERE 
  key_id = 'cbfd25ec7f9dee14c3ea37204555e378348a6681263b3a09b107829d8da1773d' 
  AND (
    token = 'vfp9LT5Y9pNJdM7ny9x41day33bqPuOhh/kYTGTL8IA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018