UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aWB7x3nu94AJWXyefPZu8YeaezQrLcreK8w/CtVI33k='
WHERE
key_id = '59173e14f127afc0ef15ed28ca474fecc62c471f27f723ad0c0f7acfb75a7946'
AND (
token = 'aWB7x3nu94AJWXyefPZu8YeaezQrLcreK8w/CtVI33k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)