UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'T8lu4Hyiptx+mmlt5esQRJgE54Jc7MncjIQRiwC9hfg='
WHERE
key_id = 'e9f018c1947253e8354c187fc00479fb752c2001174cf2361b35c36fb7fd2f81'
AND (
token = 'T8lu4Hyiptx+mmlt5esQRJgE54Jc7MncjIQRiwC9hfg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)