UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XaOAdHazFUwxF1cUVGtRTzoDTy6BKeMm9QJKvOR12vQ='
WHERE
key_id = '0d85224adef8078c93a9d7c95f583560cc811588da97beec6d11ee7588f2f8f2'
AND (
token = 'XaOAdHazFUwxF1cUVGtRTzoDTy6BKeMm9QJKvOR12vQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)