UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+5o7w+0la8F5wjcpD0N1VbOwA1Z5bZRr21YdrD5MyQk='
WHERE
key_id = 'c89dd9bedd8f22c6e4ed969ad8555024d79f76ada374b30802e9a447bb65fec9'
AND (
token = '+5o7w+0la8F5wjcpD0N1VbOwA1Z5bZRr21YdrD5MyQk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)