UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gXX18qUmNDinAadvNR1z9wJ8bVPUzk7/5C8VTfk7VZE='
WHERE
key_id = 'e120d4e8356c48c8c4684e8673e5f6880012ffa10573755138a6171602737930'
AND (
token = 'gXX18qUmNDinAadvNR1z9wJ8bVPUzk7/5C8VTfk7VZE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)