UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5acFChXSy+msL0ZgqkVViLP6wuRcL6ZmYfvMlODj9Dw='
WHERE
key_id = 'fdf2690ec0fc3e72f7a72bc465597377dd496b790820abef01b49ff66089da11'
AND (
token = '5acFChXSy+msL0ZgqkVViLP6wuRcL6ZmYfvMlODj9Dw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)