UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KYMabd8mbo2sxuV5wXMQxc3IMKx7oieIfzRp7OqwlaI='
WHERE
key_id = 'dc646fb281004e7225f7525146a3bf7dc2f467d56916e1950fadcbe7ede2a16b'
AND (
token = 'KYMabd8mbo2sxuV5wXMQxc3IMKx7oieIfzRp7OqwlaI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)