UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5Q1BCLot0imd0K/yaMDZBsDF1JSQzHLB2FNv8ZfGE1w='
WHERE
key_id = '59a04b923af0315761a414f7e321ada90eb4f5af9b8c8231c97087210722494b'
AND (
token = '5Q1BCLot0imd0K/yaMDZBsDF1JSQzHLB2FNv8ZfGE1w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)