UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tQuTR46dyJM3q2hzThYNrq6bdNG+hjuaX+jJRfQpHKs='
WHERE
key_id = 'ebfdf5f101b4ee5a6fdda2851d1cee2e8faba2091e2863307938c16686719a55'
AND (
token = 'tQuTR46dyJM3q2hzThYNrq6bdNG+hjuaX+jJRfQpHKs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)