UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4QPgZWh+eFNwpzw7WXajngB1H6UdJMqIT801ngbqSgs='
WHERE
key_id = '9d402bdf665fdab75da5f51353ff5ce0984c83427660668d69c44993592d9f90'
AND (
token = '4QPgZWh+eFNwpzw7WXajngB1H6UdJMqIT801ngbqSgs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)