UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'k6UaH4xYjSt1zvVdeF34TKAJSrs5tNEwKlTdH+H5DRM='
WHERE
key_id = 'e61f40ffa54c9fbc583425e4a515fe341f95abf083fbc8bd9e7666f513e819bd'
AND (
token = 'k6UaH4xYjSt1zvVdeF34TKAJSrs5tNEwKlTdH+H5DRM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)