UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uiGUdCeiZxVNWmvoZEG+7oqt+tRG3GJj8/3FzsFuh00='
WHERE
key_id = 'e24dbb931f17d8eff09de25b7cf443d52209d4bc8bc8f82b28007d9fd9e402f6'
AND (
token = 'uiGUdCeiZxVNWmvoZEG+7oqt+tRG3GJj8/3FzsFuh00='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)