UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vNJeDekhe71mV69PjLTigYXtiCfcWIHbzwBlinB+JRU='
WHERE
key_id = '167b8501284f905ee3d394e22f8d6ece22ec8c33b42398f7e1349a1a0f6c7100'
AND (
token = 'vNJeDekhe71mV69PjLTigYXtiCfcWIHbzwBlinB+JRU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)