UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vJfZVfQgGlbxYsGbMQxZuOn5HR+fAJEot07Rd8Q3Jp0=' 
WHERE 
  key_id = 'a8be81c5ba20abf7e4220995ab3c9b59b8da66ad71dead81dd55a1a4084836bd' 
  AND (
    token = 'vJfZVfQgGlbxYsGbMQxZuOn5HR+fAJEot07Rd8Q3Jp0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022