UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TJZWw6ReHBPDNSTKoqWUp+46uYx3np/zaXyp9pptbLA='
WHERE
key_id = '48221995b361ad1b160e3992d14d003fa11dcd9212f7fe262547f7ef6d0be92e'
AND (
token = 'TJZWw6ReHBPDNSTKoqWUp+46uYx3np/zaXyp9pptbLA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)