UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0F9NX22bbQWVqwQuyZfSmdM6WcI6gbO4lA/Ef6B1ai8='
WHERE
key_id = 'ace78476cccd49296d24f8362baa6c93b44e402c27458898469dd2b926b27663'
AND (
token = '0F9NX22bbQWVqwQuyZfSmdM6WcI6gbO4lA/Ef6B1ai8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)