UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NJXpR/1RdC9zDaYAvIssXHi1gwJjIni4iyCzGD922ko='
WHERE
key_id = 'bfa509bbef8eb5778ffa6846013e81d5cc361d0a8c7627b55108758319836b4a'
AND (
token = 'NJXpR/1RdC9zDaYAvIssXHi1gwJjIni4iyCzGD922ko='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)