UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BgRrT/+5D+KYV2dA7uoOZljBoK+UtWp6tIxtIbkMf04='
WHERE
key_id = '301df9201ad2522267913755e7c13b191219ad45c31972f84afe0d6c39a986c9'
AND (
token = 'BgRrT/+5D+KYV2dA7uoOZljBoK+UtWp6tIxtIbkMf04='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)