UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ykfOyJXQhb0zRkOLqFrPk9+zUsnTeVqYxAzAeitawP8='
WHERE
key_id = '40171e9a1cd055347c6e524ae337e11db448632c3e3b616876bd2cf742f41a65'
AND (
token = 'ykfOyJXQhb0zRkOLqFrPk9+zUsnTeVqYxAzAeitawP8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)