UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '04i5nDWvEf54O7CsWmA8Hz0ZWwxQMx289FT8/WJF6MM='
WHERE
key_id = 'fd5ca45d6bff78d94c3519d67e219aafaa7e8b2983c1d0341caacdbf92f796b8'
AND (
token = '04i5nDWvEf54O7CsWmA8Hz0ZWwxQMx289FT8/WJF6MM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)