UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9849LD72hNICoX4fLgJKDSXA+hwKRBNjhX5RkTl/nHg='
WHERE
key_id = 'a5a7195207d10abcd338a031ba68d499fc669f7eac04fe12b351cf4d0f269e67'
AND (
token = '9849LD72hNICoX4fLgJKDSXA+hwKRBNjhX5RkTl/nHg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)