UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oNcG8cURyPzR7/Hfu9yLQtbs3CsYJhOHdn2EJa5BiM8='
WHERE
key_id = 'a1a3dfd7baa1b2207914677827d8a60243bfe9e63bfaa977d915268434988fff'
AND (
token = 'oNcG8cURyPzR7/Hfu9yLQtbs3CsYJhOHdn2EJa5BiM8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)